import ui
import clutter

# br0kdz
#def animate(icon):
#    timeline = clutter.Timeline(fps=30, duration=1000)
#    timeline.set_loop(True)
#    
#    alpha = clutter.Alpha(timeline, clutter.sine_func)
#    o_behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255)
#    o_behaviour.apply(icon)
#    
#    timeline.start()

def animate(icon, timeline, alpha):
#    timeline.set_loop(True)
    
#    alpha = clutter.Alpha(timeline, clutter.sine_func)
    behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255)
    behaviour.apply(icon)

    timeline.start()

stage = clutter.Stage()
icon = ui.IconButton()
icon.set_icon_name('folder')
icon.set_label('label')
stage.add(icon)
stage.show_all()

#animate(icon)
timeline = clutter.Timeline(fps=30, duration=1000)
timeline.set_loop(True)
#
alpha = clutter.Alpha(timeline, clutter.sine_func)
#o_behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255)
#o_behaviour.apply(icon)

animate(icon,timeline,alpha)

clutter.main()